[dev-dependencies.bar]
version = "0.5.0"
- path = "bar"
+ path = "../bar"
[[bin]]
-
name = "foo"
"#)
- .file("src/foo.rs",
- main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
- .file("bar/Cargo.toml", r#"
- [project]
+ .file("src/main.rs",
+ main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice());
+ let p2 = project("bar")
+ .file("Cargo.toml", r#"
+ [package]
name = "bar"
version = "0.5.0"
authors = ["wycats@example.com"]
-
- [[lib]]
-
- name = "bar"
"#)
- .file("bar/src/bar.rs", r#"
+ .file("src/lib.rs", r#"
pub fn gimme() -> &'static str {
"zoidberg"
}
- "#)
- ;
+ "#);
+ p2.build();
assert_that(p.cargo_process("cargo-build"),
execs().with_stdout(format!("{} bar v0.5.0 (file:{})\n\
{} foo v0.5.0 (file:{})\n",
version = "0.0.1"
authors = []
"#)
- .file("src/lib.rs", "pub fn foo(){}")
+ .file("src/lib.rs", "
+ pub fn foo(){}
+ #[test] fn lib_test() {}
+ ")
.file("src/main.rs", "
extern crate foo;
+
fn main() {}
+
+ #[test]
+ fn bin_test() {}
");
- assert_that(p.cargo_process("cargo-test"), execs().with_status(0));
+ assert_that(p.cargo_process("cargo-test"),
+ execs().with_status(0)
+ .with_stdout(format!("\
+{compiling} foo v0.0.1 (file:{dir})
+
+running 1 test
+test bin_test ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
+
+
+running 1 test
+test lib_test ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
+
+", compiling = COMPILING, dir = p.root().display()).as_slice()));
})
test!(test_with_deep_lib_dep {